<?php 

namespace app\admin\model;

use think\model\concern\SoftDelete;
/**
* 设备列-模型
* Class DeviceImei
 */
class DeviceImei extends BaseModel
{
    use SoftDelete;
    // 设置数据表名
    protected $name = "device_imei";
    protected $autoWriteTimestamp = true;



    public function setActiveTimeAttr($value)
    {
        if (empty($value)) return '';
        return strtotime($value);
    }

    public function setExpireTimeAttr($value)
    {
        if (empty($value)) return '';
        return strtotime($value);
    }

    public function deviceModel()
    {
        return $this->belongsTo(DeviceModel::class,'model_id', 'id')->bind([
            'model_name' => 'name'
        ]);
    }

}

